﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using System.Data;

namespace WebsiteAdmin.Wilson.ProInfo
{
    public partial class ProOtherEdit : System.Web.UI.Page
    {
        public int proId = 0;
        public int pkid = 0;
        public string proName = string.Empty;
        public string bigImgUrl = string.Empty;
        public string mediumImgUrl = string.Empty;
        public string smallImgUrl = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                proId = Convert.ToInt16(Request["proId"], CultureInfo.InvariantCulture);
                pkid = Convert.ToInt16(Request["pkid"], CultureInfo.InvariantCulture);
                Select(Global.ConnWilson, " PKID=" + pkid);
                SelectPro(Global.ConnWilson, proId);
            }
        }

        protected void Select(string strCon, string whereStr)
        {
            using (DataTable dt = Bll.ProOtherInfo.Single(strCon, whereStr)) 
            {
                if (dt != null && dt.Rows.Count > 0) 
                {
                    bigImgUrl = dt.Rows[0]["OtherBigImgURL"].ToString();
                    mediumImgUrl = dt.Rows[0]["OtherMediumImgURL"].ToString();
                    smallImgUrl = dt.Rows[0]["OtherSmallImgURL"].ToString();
                }   
            }
        }

        protected void SelectPro(string strCon,int proId) 
        {
            using(DataTable dt = Bll.Product.Single(strCon,proId))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    proName = dt.Rows[0]["ProName"].ToString();
                }
            }
        }
    }
}
